package com.bookshop.controller;

import com.bookshop.entity.Carousel;
import com.bookshop.entity.response.R;
import com.bookshop.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/carousel")
public class CarouselController {

    private CarouselService carouselService;
    @Autowired
    public CarouselController(CarouselService carouselService) {
        this.carouselService = carouselService;
    }

    @GetMapping("/getAll")
    public R selectAllCarousel(){

        List<Carousel> carouselList= carouselService.selectAllCarousel();

        return R.ok().put("data",carouselList);
    }
    @GetMapping("/getCarouselInterval")
    public R getCarouselInterval(){
        String carouselInterval= carouselService.getCarouselInterval();
        return R.ok().put("data",carouselInterval);
    }

}
